<?php
/**
 * Created by PhpStorm.
 * User: Dell
 * Date: 2019-3-28
 * Time: 10:30
 */

namespace app\index\controller;


use think\Controller;
use think\Session;

class Base extends Controller
{
    public function _initialize()
    {
        if (empty(Session::get('id'))){
            if (!request()->isAjax()){

                $arr = explode("=",$_SERVER['QUERY_STRING']);
                $good_id = $arr[count($arr)-1];
                $arr = explode(".",$_SERVER['QUERY_STRING']);
                $url = $arr[0];
                $arr['good_id'] = $good_id;
                $arr['url'] = $url;
                Session::set('url',$arr);
                $this->redirect('index/login');
            }else{
                return json(msg(-1,'','请登录'));

            }
        }
    }
}